package com.itheima.dianming.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.dianming.pojo.domain.Stu;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface StuMapper extends BaseMapper<Stu> {

    @Select("select count(*) as value,concat(work_time,'年') as name " +
            " from tb_stu  where username!='admin' " +
            " group by work_time order by work_time")
    List<Map> staticsByWorkTime();

    @Select("select count(*) as value,education as name " +
            " from tb_stu  where username!='admin' " +
            " group by education order by education")
    List<Map> staticsByEducation();

    @Select("select count(*) as value,concat(expect_salary,'K') as salary  " +
            " FROM tb_stu where username!='admin' " +
            "group by expect_salary" +
            " order by expect_salary")
    List<Map> staticsBySalary();

    @Select("select avg(expect_salary) from tb_stu where username != 'admin'")
    Long avgSalary();
}
